package com.hxq.library.dao;

import com.hxq.library.entity.User;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * @Author: Ljx
 * @Date: 2021/11/24 13:27
 * @role:
 */
public interface IUserDao {
    /**
     * 注册用户
     * @param connection
     * @param user
     * @return
     */
    boolean login(Connection connection,User user) throws SQLException;

    /**
     * 登录用户
     * @param connection
     * @param account
     * @param password
     * @return
     */
    boolean register(Connection connection ,String account,String password);


    /**
     * 余额充值
     * @param connection
     * @param money
     * @param account
     * @param password
     * @param number
     * @return
     * @throws SQLException
     */
    boolean pay(Connection connection,int money,String account,String password,String number) throws SQLException;

    /**
     * 查询金额
     * @param connection
     * @param account
     * @return
     * @throws SQLException
     */
    int selectMoney(Connection connection, String account) throws SQLException;

    /**
     * 充值VIP
     * @param connection
     * @param account
     * @return
     * @throws SQLException
     */
    int payVip(Connection connection, String account) throws SQLException;

    /**
     * 查询会员状态
     * @param connection
     * @param account
     * @return
     * @throws SQLException
     */
    int selectVip(Connection connection, String account) throws SQLException;

    /**
     * 修改密码
     * @param connection
     * @param account
     * @param oldPassword
     * @param password
     * @return
     * @throws SQLException
     */
    boolean changePassword(Connection connection,String account,String oldPassword, String password) throws SQLException;

    /**
     * 忘记密码
     * @param connection
     * @param account
     * @param number
     * @param code
     * @return
     * @throws SQLException
     */
    boolean forgetPassword(Connection connection,String account,String number, String code) throws SQLException;

    /**
     * 忘记密码时更新密码操作
     * @param connection
     * @param account
     * @param newPassword
     * @return
     * @throws SQLException
     */
    boolean changePassword(Connection connection, String account,String newPassword) throws SQLException;

    /**
     * 查询用户是否存在
     * @param connection
     * @param account
     * @return
     * @throws SQLException
     */
    boolean selectUser(Connection connection, String account) throws SQLException;
}
